﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;

namespace ABC.Customer
{
    public class Address
    {
        public string CustAddress { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string ZipCode { get; set; }
        public Address(long custCode)
        {
            String sqlString = @"SELECT tabADDRESS.CODE, tabADDRESS.ADDR, tabADDRESS.ZIP, tabZIP.CITY, tabZIP.STATE, tabADDRESS.LATITUDE, 
                    tabADDRESS.LONGITUDE FROM tabZIP INNER JOIN tabADDRESS ON tabZIP.ZIPCODE = tabADDRESS.ZIP WHERE (((tabADDRESS.CODE)=" + custCode + "));";
            OleDbCommand command = new OleDbCommand(sqlString, ABC.Database.DataBaseConnection.MyConn);
            OleDbDataReader areader = command.ExecuteReader();
            while (areader.Read())
            {
                CustAddress = areader["ADDR"].ToString();
                City = areader["CITY"].ToString();
                State = areader["STATE"].ToString();
                ZipCode = areader["ZIP"].ToString();

            }
            areader.Close();
        }
    }

  
}
